<template>
  <el-config-provider :locale="zhCn">
    <RouterView />
  </el-config-provider>
</template>

<script setup>
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import { useCounterStore } from "@/stores/counter.js";
// import Watermark from "@/plugins/wartermark"; // 引入水印
const store = useCounterStore();
function getWindowClient() {
  let windowWidth = document.documentElement.clientWidth; //实时屏幕宽度
  let windowHeight = document.documentElement.clientHeight; //实时屏幕高度

  store.windowWidth = windowWidth;
  store.windowHeight = windowHeight;
  if (windowWidth < 900) {
    store.isCollapse = true;
    store.menuWidth = "65px";
  }
}
// 获取用户信息//公司信息
function getUser() {
  let userInfo = localStorage.getItem("manpu_userInfo");
  if (userInfo) {
    store.userInfo = JSON.parse(userInfo);
  }
  let config = localStorage.getItem("manpu_config");
  if (config) {
    store.configInfo = JSON.parse(config);
  }
  document.title = store.configInfo.site_name;
}

onMounted(() => {
  // Watermark.set("水印"); // 水印内容
  getUser();
  getWindowClient();
  window.addEventListener("resize", () => {
    getWindowClient();
  });
});
</script>
